﻿

using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using System.Reflection;
using System.Windows.Forms;

namespace LoadDll
{
    public class Class1
    {
        [CommandMethod("NL")]
        public void myLoad()

        {

            //AutoCAD命令栏

            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //调用Windows.Forms选择一个文件

            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.Multiselect = true;

            //判断确认按钮

            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                foreach (string file_dir in fileDialog.FileNames)
                {
                    ed.WriteMessage("文件路径:" + file_dir);

                    byte[] buffer = System.IO.File.ReadAllBytes(file_dir);

                    ////加载内存中的文件

                    Assembly assembly = Assembly.Load(buffer);
                }


            }

        }
    }
}
